package com.sphd.restaurantsystem.model;


import com.android.volley.VolleyError;
import com.sphd.restaurantsystem.interfaces.VolleyJsonObjectCallBack;
import com.sphd.restaurantsystem.presenter.AddJiFenPresenterImpl;

import org.json.JSONException;
import org.json.JSONObject;

/**
* Created by Hu on 2016/12/22
*/

public class AddJiFenModelImpl implements AddJiFenModel {

    @Override
    public void sendUrL(String url, AddJiFenPresenterImpl addJiFenPresenter) {
        volleyUtil.setJsonObjectRequest(url, new VolleyJsonObjectCallBack() {
            @Override
            public void onResponse(JSONObject response) {
                try {
                    int res =response.getInt("res");
                    addJiFenPresenter.sendRes(res);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onErrorResponse(VolleyError error) {
            addJiFenPresenter.sendError(error);
            }
        });
    }
}